package 每日一题;

/**
 * @author 会玩的洋洋
 * https://leetcode.cn/problems/maximum-value-at-a-given-index-in-a-bounded-array/
 */
public class _1802_有界数组中指定下标处的最大值 {
    public int maxValue(int n, int index, int maxSum) {
        int x = maxSum - n;
        int count = 2;
        int y = x / count;
        while (y > 1) {
            count++;
            y = x / count;
        }
        return count;
    }
}
